<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 00:33:05
 * @LastEditTime: 2023-05-06 00:05:39
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: 岗位
 */

namespace App\Models;


class Position extends BaseModel
    {
    public $timestamps = true;
    public $table = "basedata_position";
    protected $guarded = [];

    public function users()
        {
        return $this->hasMany(Employee::class, "position_id")->orderBy("sort");
        }
    public function pro_process()
        {
        return $this->hasOne(ProProcesses::class, "position_id");
        }
    public function productivity_method()
        {
        return $this->belongsTo(Dic::class, "productivity_method_id", "key")->where(function ($q)
            {
            $q->where("code", 'Productivity_Method');
            });
        }
    public function productivity_way()
        {
        return $this->belongsTo(Dic::class, "productivity_way_id", "key")->where(function ($q)
            {
            $q->where("code", 'Productivity_Way');
            });
        }
    }
